package com.atom.module.mvi.binder.lifecycle

import com.atom.module.mvi.binder.lifecycle.Lifecycle.Event
import com.atom.module.mvi.binder.lifecycle.Lifecycle.Event.BEGIN
import com.atom.module.mvi.binder.lifecycle.Lifecycle.Event.END
import io.reactivex.rxjava3.subjects.BehaviorSubject

class ManualLifecycle(private val subject : BehaviorSubject<Event> = BehaviorSubject.create()) :
    Lifecycle by Lifecycle.wrap(subject) {// 代理类

    fun begin() = subject.onNext(BEGIN)
    fun end() = subject.onNext(END)
}
